package db;

import android.util.Log;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

import model.Constants;

/**
 * Created by Administrator on 2017/7/18.
 */

public class WorkReadAndWrite {

    public static void writeFileSdcard(String fileName, String message) {

         String absPath = Constants.File_PATH + "/work/" + fileName;

        File newfile = new File(Constants.File_PATH + "/work",fileName);

            if(!newfile.exists())
                newfile.mkdir();


        try {

            // FileOutputStream fout = openFileOutput(fileName, MODE_PRIVATE);

            FileOutputStream fout = new FileOutputStream(absPath);

            byte[] bytes = message.getBytes();

            fout.write(bytes);

            fout.close();

        }

        catch (Exception e) {

            e.printStackTrace();

        }

    }

}
